import { ISEO } from './iseo';
import { Model, DataType,  } from 'sequelize-typescript';
import { Table, Column } from './decorate';
@Table({
    underscored: true,
    underscoredAll: true,
    timestamps: true,
    paranoid: true,
    indexes: [
        {
            fields: ['category_id']
        },
        {
            fields: ['author_id']
        },
        {
            fields: ['type']
        }
    ]
})
export default class Article extends Model<Article> implements ISEO{
    @Column
    title!: string;

    @Column({
        type: DataType.TEXT
    })
    content!: string;

    @Column({
        type: DataType.TEXT
    })
    submmary!: string;
    
    @Column
    authorId!: number;

    @Column
    categoryId!: number;

    @Column
    type!: AritcleType;

    @Column({
        type: DataType.TEXT
    })
    seoDescription!: string;

    @Column({
        type: DataType.TEXT
    })
    seoKeywords!: string;

    @Column
    seoTitle!: string
}


export enum AritcleType {
    ARTICLE = 1,    //文章
    ALBUM = 2,      //相册
    VIDEO = 3,      //视频
    SINGLE_PAGE = 4,    //单页
}